﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPage/Home.Master" AutoEventWireup="true"
    CodeBehind="Administrator.aspx.cs" Inherits="TTMarketing.Admin.Administrator" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHeader" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceMain" runat="server">
    <asp:Panel ID="plContent" runat="server">
        <div id="close">
            <table width="100%">
                <tr>
                    <td>
                        <asp:Label ID="lblTitle" runat="server" Style="font-size: 30px" Text="Tài khoản quản trị"></asp:Label>
                    </td>
                    <td align="right" width="100px">
                        <asp:Label ID="lblStt" runat="server" Text="Trạng thái "></asp:Label>
                        <telerik:RadComboBox ID="cmbClose" runat="server" AutoPostBack="True" OnSelectedIndexChanged="cmbClose_SelectedIndexChanged"
                            Width="100px">
                            <Items>
                                <telerik:RadComboBoxItem runat="server" Text="Close" Value="0" />
                                <telerik:RadComboBoxItem runat="server" Text="Open" Value="1" />
                            </Items>
                        </telerik:RadComboBox>
                    </td>
                </tr>
            </table>
        </div>
        <div id="divmessage2" runat="server">
        </div>
        <asp:Panel ID="plDetail" runat="server" Visible="False">
            <div id="divmessage" runat="server">
            </div>
            <fieldset>
                <legend>Thông tin tài khoản quản trị</legend>
                <table width="100%">
                    <tr>
                        <td width="200px">
                            <asp:Label ID="lblUserName" runat="server" Text="Tên đăng nhập"></asp:Label>
                        </td>
                        <td>
                            <telerik:RadTextBox ID="txtUserName" runat="server" Width="100%" ValidationGroup="a">
                            </telerik:RadTextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="lblFullName" runat="server" Text="Họ Tên"></asp:Label>
                        </td>
                        <td>
                            <telerik:RadTextBox ID="txtFullName" runat="server" Width="100%" ValidationGroup="a">
                            </telerik:RadTextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="lblEmail" runat="server" Text="Email"></asp:Label>
                        </td>
                        <td>
                            <telerik:RadTextBox ID="txtEmail" runat="server" Width="100%" ValidationGroup="a">
                            </telerik:RadTextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="lblOrderRequest" runat="server" Text="Nhận đơn hàng"></asp:Label>
                        </td>
                        <td>
                            <telerik:RadComboBox ID="cmbOrderRequest" runat="server">
                                <Items>
                                    <telerik:RadComboBoxItem runat="server" Owner="cmbOrderRequest" Text="Có nhận đơn"
                                        Value="1" />
                                    <telerik:RadComboBoxItem runat="server" Owner="cmbOrderRequest" Text="Không nhận đơn"
                                        Value="0" />
                                </Items>
                            </telerik:RadComboBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                        <td>
                            &nbsp;
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtUserName"
                                Display="None" ErrorMessage="Tên đăng nhập không được rỗng" ValidationGroup="a"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                                ControlToValidate="txtEmail" Display="None" 
                                ErrorMessage="Email không đúng định dạng" 
                                ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" 
                                ValidationGroup="a"></asp:RegularExpressionValidator>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtFullName"
                                Display="None" ErrorMessage="Họ tên không được rỗng" ValidationGroup="a"></asp:RequiredFieldValidator>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtEmail"
                                Display="None" ErrorMessage="Email không được rỗng" ValidationGroup="a"></asp:RequiredFieldValidator>
                            <asp:ValidationSummary ID="ValidationSummary1" runat="server" Style="color: #FF9900;
                                font-style: italic; font-size: 10px" ValidationGroup="a" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:HiddenField ID="hfId" runat="server" />
                        </td>
                        <td>
                            <asp:Button ID="btnSaveNew" runat="server" Text="Lưu mới" CssClass="botton" OnClick="btnSaveNew_Click"
                                ToolTip="Lưu bản ghi mới" ValidationGroup="a" />
                            &nbsp;<asp:Button ID="btnSave" runat="server" CssClass="botton" OnClick="btnSave_Click"
                                Text="Lưu sửa" ToolTip="Cập nhật bản ghi hiện hành" ValidationGroup="a" />
                            &nbsp;<asp:Button ID="btnReset" runat="server" OnClick="btnReset_Click" Text="Reset mật khẩu"
                                ToolTip="Reset lại mật khẩu cho khách hàng" />
                            &nbsp;<asp:Button ID="btnClear" runat="server" CssClass="botton" OnClick="btnClear_Click"
                                Text="Reset" ToolTip="Nhập lại dữ liệu" />
                        </td>
                    </tr>
                </table>
                <br />
                <br />
            </fieldset>
        </asp:Panel>
        <asp:Panel ID="Panel2" runat="server" Width="100%">
            <telerik:RadGrid ID="rgdGrid" runat="server" AllowPaging="True" AllowSorting="True"
                DataSourceID="odsAdmin" GridLines="None" ShowFooter="True" OnItemCommand="rgdGrid_ItemCommand"
                OnSelectedIndexChanged="RadGrid1_SelectedIndexChanged">
                <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True" EnablePostBackOnRowClick="True"
                    EnableRowHoverStyle="True" AllowRowsDragDrop="True">
                    <Selecting AllowRowSelect="True" />
                    <Selecting AllowRowSelect="True" />
                </ClientSettings>
                <MasterTableView AutoGenerateColumns="False" DataSourceID="odsAdmin">
                    <RowIndicatorColumn>
                        <HeaderStyle Width="20px" />
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn>
                        <HeaderStyle Width="20px" />
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" HeaderText="Mã" SortExpression="ID"
                            UniqueName="ID">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="UserName" HeaderText="Tên đăng nhập" SortExpression="UserName"
                            UniqueName="UserName">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Email" HeaderText="Email" SortExpression="Email"
                            UniqueName="Email">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="FullName" HeaderText="Họ tên" SortExpression="FullName"
                            UniqueName="FullName">
                        </telerik:GridBoundColumn>
                        <telerik:GridCheckBoxColumn DataField="OrderRequest" DataType="System.Boolean" HeaderText="Nhận đơn hàng"
                            SortExpression="OrderRequest" UniqueName="OrderRequest">
                        </telerik:GridCheckBoxColumn>
                        <telerik:GridTemplateColumn HeaderText="Action" UniqueName="TemplateColumn">
                            <ItemTemplate>
                                <asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/Admin/Images/Button/Delete_Grid.gif"
                                    CommandArgument='<%# Eval("ID") %>' CommandName="delete" OnClientClick=" return confirm(&quot;Bạn có chắc chắn muốn xóa?&quot;);" />
                            </ItemTemplate>
                            <ItemStyle Width="40px" />
                        </telerik:GridTemplateColumn>
                    </Columns>
                </MasterTableView>
                <HeaderContextMenu EnableAutoScroll="True">
                </HeaderContextMenu>
            </telerik:RadGrid>
            <asp:ObjectDataSource ID="odsAdmin" runat="server" SelectMethod="getAll" 
                TypeName="TTBusiness.ClassDB.clsBSAdmin">
            </asp:ObjectDataSource>
        </asp:Panel>
    </asp:Panel>
    <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" 
        EnableHistory="True">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="btnSaveNew">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="divmessage2" />
                    <telerik:AjaxUpdatedControl ControlID="rgdGrid" />
                    <telerik:AjaxUpdatedControl ControlID="plDetail" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnSave">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="divmessage2"  />
                    <telerik:AjaxUpdatedControl ControlID="rgdGrid"  />
                    <telerik:AjaxUpdatedControl ControlID="plDetail" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="rgdGrid">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="cmbClose" />
                    <telerik:AjaxUpdatedControl ControlID="divmessage2"  />
                    <telerik:AjaxUpdatedControl ControlID="plDetail" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnReset">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="divmessage2" />
                    <telerik:AjaxUpdatedControl ControlID="rgdGrid" />
                    <telerik:AjaxUpdatedControl ControlID="plDetail" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnClear">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="divmessage2"  />
                    <telerik:AjaxUpdatedControl ControlID="plDetail" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="cmbClose">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="divmessage2"  />
                    <telerik:AjaxUpdatedControl ControlID="plDetail" LoadingPanelID="Loading" UpdatePanelRenderMode="Inline" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
</asp:Content>
